<?php
defined('IN_IA') or exit('Access Denied');
//function upload(){
global $_W;
global $_GPC;
//exit($_FILES["file"]["name"]);
$file = $_FILES['file'];
//$dir =  "./upload/";
$y = date("Y",time());
$m = date('m',time());
$fdir = "images/".$y."/".$m."/";
$dir = ATTACHMENT_ROOT . "/upload/". $fdir;
//echo $dir;
if(!is_dir($dir)){
    mkdir ($dir,0777,true);
}
//exit($dir);
if(move_uploaded_file($_FILES["file"]["tmp_name"],$dir. $_FILES["file"]["name"])){
    echo json_encode($fdir.$_FILES["file"]["name"], JSON_UNESCAPED_SLASHES),"\n";
}else{
    echo ("eror");
}

